package com.itheima.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.service.MemberService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/category")
public class CategoryController {

    @Reference
    private MemberService memberService;

    //根据病情查询患者信息
    @RequestMapping("/findIllnessMember")
    private PageResult findIllnessMember(@RequestBody QueryPageBean pageBean){
         return   memberService.findIllnessMember(pageBean);
    }

    //根据id删除病人该项信息
    @RequestMapping("/delectByIllnessIdAndMemberId")
    private  Result delectByIllnessIdAndMemberId(String id ,String memberId){
        try {
            memberService.delectByIllnessIdAndMemberId(id,memberId);
            return new Result(true,MessageConstant.DELETE_SUCCESS);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,MessageConstant.DELETE_FAIL);
        }
    }

}
